﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using WCFMINERP.Contracts.InterFaces;
using WCFMINERP.Contracts.DataContracts;
using WCFMINERP.BLL.ShopBLL;
using WCFMINERP.ContextPropagation;

namespace WCFMINERP.Services.Shop
{
    public class Shop:IShop
    {
        ShopBLL _bll = new ShopBLL();

        /// <summary>
        /// 获得商户信息
        /// </summary>
        /// <param name="ftpLoginName"></param>
        /// <param name="ftpLoginPwd"></param>
        /// <returns></returns>
        public ShopInfo GetShopInfoA(string ftpLoginName, string ftpLoginPwd,string ShaCode)
        {
            //string ShaCode = (string)ApplicationContext.Current.SHACODE;
            return _bll.GetShopInfo(ftpLoginName, ftpLoginPwd, ShaCode);
        }
        /// <summary>
        /// 获得商户信息
        /// </summary>
        /// <param name="ftpLoginName"></param>
        /// <param name="ftpLoginPwd"></param>
        /// <returns></returns>
        public ShopInfo GetShopInfo(string ftpLoginName, string ftpLoginPwd)
        {
            //string ShaCode = (string)ApplicationContext.Current.SHACODE;
            return _bll.GetShopInfo(ftpLoginName, ftpLoginPwd);
        }


        /// <summary>
        /// 检查是否需要更新
        /// </summary>
        /// <param name="clientVersion"></param>
        /// <returns></returns>
        public bool CheckUpdate(string clientVersion,int shopId)
        {
            return _bll.CheckUpdate(clientVersion, shopId); 
        }

        /// <summary>
        /// 获取客户端当前版本
        /// </summary>
        /// <returns></returns>
        public VersionInfo GetCurrentVersion(int shopId)
        {
            return _bll.GetCurrentVersion(shopId);
            
        }
            
        /// <summary>
        /// 获取更新文件
        /// </summary>
        /// <returns></returns>
        public TransferFileInfo GetFile()
        {
            return _bll.GetFile();
        }
        
        /// <summary>
        /// 获得最新的产品文件
        /// </summary>
        /// <param name="shopId"></param>
        /// <returns></returns>
        public List<ShopProductInfo> GetProductFile(int shopId, out List<PaperFaceInfo> paperFaceInfo, out List<PaperTypeInfo> paperTypeInfo, out List<CommonChargeItemInfo> commonChargeItemInfo)
        {
            return _bll.GetProduct(shopId, out paperFaceInfo, out paperTypeInfo, out commonChargeItemInfo);
        }
        /// <summary>
        /// 注册新用户
        /// </summary>
        /// <param name="inUserID"></param>
        /// <param name="inPwd"></param>
        /// <param name="inShacode"></param>
        /// <returns></returns>
        public int RegisterNewUser(string inUserID, string inPwd, string inShacode)
        {
            return _bll.RegisterNewUser(inUserID, inPwd, inShacode);
        }
        /// <summary>
        /// 更改用户密码
        /// </summary>
        /// <param name="inUserID"></param>
        /// <param name="inOldPwd"></param>
        /// <param name="inShacode"></param>
        /// <param name="inNewPwd"></param>
        /// <returns></returns>
        public int ChangeUserPwd(string inUserID, string inOldPwd, string inShacode, string inNewPwd)
        {
            return _bll.ChangeUserPwd(inUserID, inOldPwd, inShacode, inNewPwd);
        }
       
    }
}
